package dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import entity.Account;

public class HibernateAccountDAO implements IAccountDAO {

	private HibernateTemplate hibernateTemplate;

	public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
		this.hibernateTemplate = hibernateTemplate;
	}

	public void save(Account account) {
		hibernateTemplate.save(account);
	}

	public void update(Account account) {
		hibernateTemplate.update(account);
	}

	public void delete(Account account) {
		hibernateTemplate.delete(account);
	}

	public Account getById(int id) {
		return (Account) hibernateTemplate.get(Account.class, id);
	}

	public List<Account> getAll() {
		return (List<Account>) hibernateTemplate.find("from Account");
	}

}
